<style scoped>
    .dayChose{margin-bottom: 10px;display: inline-block;}
    .dayChose>div{display: inline-block;}
    .dayChose .el-radio{margin-right: 10px;}
    .dayChose span{line-height: 24px;display: inline-block;padding: 0px 5px;}
    .dayChose .el-form-item{margin-bottom: 0px;margin-right: 0px;}
    .dayChose .el-date-editor.el-input{width:140px;}
    .dayChose  .el-select{width: 100px}
  
</style>
<template>
    <!-- 供货替换组 -->
    <div class="tax-code-tax-rate-page">
        <el-tabs v-model="activeName" type="card"  @tab-click="handleClick">
            <!-- 供货替换关系 -->
            <el-tab-pane :label="nowLangue.supplySwitch" name="1">
                <el-form :inline="true" :model="supplyRUForm" class="demo-form-inline" style="border-bottom:1px solid #ccc;">
                    <!--法人名称-->
                    <el-form-item :label="nowLangue.legalName" class="selectMB10">
                        <el-input size="mini" v-if="legalPersonDropDown.length == 1" disabled v-model="supplyRUForm.legalPersonName" placeholder=""></el-input>
                        <el-select size="mini" v-else v-model="supplyRUForm.legalPersonId" @change="changeLegalPerson">
                            <el-option v-for="(legalPerson,index) in legalPersonDropDown" :key="index" :label="legalPerson.legalPersonName" :value="legalPerson.id"></el-option>
                        </el-select>
                    </el-form-item>
                    <!--产品线-->
                    <el-form-item :label="nowLangue.productLine" class="selectMB10">
                        <el-select size="mini" clearable v-model="supplyRUForm.productLine" :placeholder="nowLangue.pleaseSelect">
                            <el-option v-for="(product,index) in productLineList" :key="index" :label="product.label" :value="product.value"></el-option>
                        </el-select>
                    </el-form-item>
                    <!--计划大类-->
                    <el-form-item :label="nowLangue.planBigClass" class="selectMB10">
                        <el-select size="mini" clearable v-model="supplyRUForm.planCategoryCode" :placeholder="nowLangue.pleaseSelect" >
                            <el-option v-for="(planCategory,index) in planCategoryList" :key="index" :label="planCategory.name" :value="planCategory.code"></el-option>
                        </el-select>
                    </el-form-item>
                    <!--状态-->
                    <el-form-item :label="nowLangue.status" class="selectMB10">
                        <el-select size="mini" clearable v-model="supplyRUForm.active" :placeholder="nowLangue.pleaseSelect">
                            <el-option v-for="(status,index) in statusList" :key="index" :label="status.label" :value="status.value"></el-option>
                        </el-select>
                    </el-form-item>
                    <!--供货替换组编码-->
                    <el-form-item :label="nowLangue.supplyReplaceGroupCode" class="selectMB10">
                        <el-input size="mini" type="text" v-model="supplyRUForm.code" :placeholder="nowLangue.pleaseImport+nowLangue.supplyReplaceGroupCode"></el-input>
                    </el-form-item>
                    <!--供货替换组名称-->
                    <el-form-item :label="nowLangue.supplyReplaceGroupName" class="selectMB10">
                        <el-input size="mini" type="text" v-model="supplyRUForm.name" :placeholder="nowLangue.pleaseImport+nowLangue.supplyReplaceGroupName"></el-input>
                    </el-form-item>
                    <!--备件编码-->
                    <el-form-item :label="nowLangue.spareCode" class="selectMB10">
                        <el-input size="mini" type="text" v-model="supplyRUForm.materialCode" :placeholder="nowLangue.pleaseImport+nowLangue.spareCode"></el-input>
                    </el-form-item>
                    <el-form-item class="selectMB10">
                        <!--查询-->
                        <el-button class="bolder outsideBtnBS selectAll" :disabled="selectDisabled" size="mini" type="danger" @click="querySupplyRU" v-text="nowLangue.query"></el-button>
                    </el-form-item>
                </el-form>
                <!--表格-->
                <label class="default-label" v-text="nowLangue.supplySwitchDetail"><!--供货替换组明细：--></label>
                <!--新增按钮-->
                <el-button class="bolder outsideBtnBS" size="mini" type="danger" @click="createNew" v-text="nowLangue.newAdd"><!--新增--></el-button>
                <el-table :data="supplyRUData" border style="width: 100%;" v-loading.body="loading" :element-loading-text="nowLangue.isLoading">
                    <!--序-->
                    <el-table-column type="index" header-align="center" align="center" :label="nowLangue.sequence" width="40"></el-table-column>
                    <!--操作-->
                    <el-table-column :label="nowLangue.operate" header-align="center" align="center" width="120">
                        <template scope="scope">
                            <!--禁用-->
                            <div class="operationItem bolder" v-if="scope.row.status != 10 && scope.row.active" @click="handleStatus(scope.$index,scope.row)" v-text="nowLangue.forbidden"></div>
                            <!--启用-->
                            <div class="operationItem bolder" v-else-if="scope.row.status != 10 && !scope.row.active" @click="handleStatus(scope.$index,scope.row)" v-text="nowLangue.enable"></div>
                            <div class="operationItem disabled bolder" v-if="scope.row.status == 10" v-text="nowLangue.enable"></div>
                            <!--修改-->
                            <div class="operationItem disabled bolder" v-if="scope.row.active" v-text="nowLangue.update"></div>
                            <!--修改-->
                            <div class="operationItem bolder" v-else @click="handleUpdate(scope.$index,scope.row)" v-text="nowLangue.update"></div>
                            <!--查看-->
                            <div class="operationItem bolder" @click="handleSee(scope.$index,scope.row)" v-text="nowLangue.check"></div>
                        </template>
                    </el-table-column>
                    <!--产品线-->
                    <el-table-column prop="productLineName" :label="nowLangue.productLine" header-align="center" show-overflow-tooltip></el-table-column>
                    <!--计划大类-->
                    <el-table-column prop="planCategoryName" :label="nowLangue.planBigClass" header-align="center" show-overflow-tooltip></el-table-column>
                    <!--供货替换组编码-->
                    <el-table-column prop="code" :label="nowLangue.supplyReplaceGroupCode" header-align="center"  show-overflow-tooltip ></el-table-column>
                    <!--供货替换组名称-->
                    <el-table-column prop="name" :label="nowLangue.supplyReplaceGroupName" header-align="center"  show-overflow-tooltip ></el-table-column>
                    <!--分库库存分配原则-->
                    <el-table-column prop="dcinvalloprincipleName" :label="nowLangue.subTreasury" header-align="center"  show-overflow-tooltip ></el-table-column>
                    <!--组内库存分配原则-->
                    <el-table-column prop="clusterinvalloprincipleName" :label="nowLangue.groupTreasury" header-align="center"  show-overflow-tooltip ></el-table-column>
                    <!--允许欠货天数-->
                    <el-table-column prop="oweDays" :label="nowLangue.admitOweDays" header-align="center"  show-overflow-tooltip></el-table-column>
                    <!--状态-->
                    <el-table-column prop="activeName" :label="nowLangue.status" header-align="center" align="center" show-overflow-tooltip></el-table-column>
                    <!--创建人-->
                    <el-table-column prop="createUserName" :label="nowLangue.creator" header-align="center"  show-overflow-tooltip></el-table-column>
                    <!--创建时间-->
                    <el-table-column prop="createTime" :label="nowLangue.createTime" header-align="center"  show-overflow-tooltip ></el-table-column>
                    <!--修改人-->
                    <el-table-column prop="updateUserName" :label="nowLangue.updater" header-align="center"  show-overflow-tooltip ></el-table-column>
                    <!--最后修改时间-->
                    <el-table-column prop="updateTime" :label="nowLangue.updateTime" header-align="center"  show-overflow-tooltip ></el-table-column>
                </el-table>
                <el-pagination v-if="isPaging"  @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page.sync="currentPage3" :current-page="pageIndex"  :page-size="pageSize" layout="total, sizes, prev, pager, next, jumper" :page-count="totalPage" :total="totalNumber"></el-pagination>
            </el-tab-pane>
            <!-- 自由条件查询 -->
            <el-tab-pane :label="nowLangue.freeConditionQuery" name="2">
                <el-form :inline="true" :model="freeSpareForm" class="demo-form-inline" style="border-bottom:1px solid #ccc;">
                    <!--法人名称
                    <el-form-item :label="nowLangue.legalName" class="selectMB10">
                        <el-input size="mini" v-if="legalPersonDropDown.length == 1" disabled v-model="freeSpareForm.legalPersonName" placeholder=""></el-input>
                        <el-select size="mini" v-else v-model="freeSpareForm.legalPersonId" @change="changeLegalPerson">
                            <el-option v-for="(legalPerson,index) in legalPersonDropDown" :key="index" :label="legalPerson.legalPersonName" :value="legalPerson.id"></el-option>
                        </el-select>
                    </el-form-item>-->
                    <!--产品线-->
                    <el-form-item :label="nowLangue.productLine" class="selectMB10">
                        <el-select size="mini" clearable v-model="freeSpareForm.productLine" :placeholder="nowLangue.pleaseSelect">
                            <el-option v-for="(product,index) in productLineList" :key="index" :label="product.label" :value="product.value"></el-option>
                        </el-select>
                    </el-form-item>
                    <!--计划大类-->
                    <el-form-item :label="nowLangue.planBigClass" class="selectMB10">
                        <el-select size="mini" clearable v-model="freeSpareForm.planCategoryCode" :placeholder="nowLangue.pleaseSelect">
                            <el-option v-for="(planCategory,index) in planCategoryList" :key="index" :label="planCategory.name" :value="planCategory.code"></el-option>
                        </el-select>
                    </el-form-item>
                    <!--备件编码-->
                    <el-form-item :label="nowLangue.spareCode" class="selectMB10">
                        <el-input  size="mini" type="text" v-model="freeSpareForm.materialCode" :placeholder="nowLangue.pleaseImport+nowLangue.spareCode"></el-input>
                    </el-form-item>
                    <el-form-item class="selectMB10">
                        <el-button class="bolder outsideBtnBS selectAll" :disabled="select2Disabled" size="mini" type="danger" @click="queryFreeSpare" v-text="nowLangue.query"><!--查询--></el-button>
                    </el-form-item>
                </el-form>
                <!--表格-->
                <label class="default-label" v-text="nowLangue.freeSpareList"><!--自由备件列表--></label>
                <!--新增按钮-->
                <el-table :data="freeSpareData" border style="width: 100%;" v-loading.body="loading2" :element-loading-text="nowLangue.isLoading">
                    <!--序-->
                    <el-table-column type="index" header-align="center" align="center" :label="nowLangue.sequence" width="40"></el-table-column>
                    <!--产品线-->
                    <el-table-column prop="productLineName" :label="nowLangue.productLine" header-align="center" show-overflow-tooltip></el-table-column>
                    <!--计划大类-->
                    <el-table-column prop="planCategoryName" :label="nowLangue.planBigClass" header-align="center" show-overflow-tooltip></el-table-column>
                    <!--备件编码-->
                    <el-table-column prop="materialCode" :label="nowLangue.spareCode" header-align="center"  show-overflow-tooltip></el-table-column>
                    <!--备件名称-->
                    <el-table-column prop="materialName" :label="nowLangue.spareName" header-align="center"  show-overflow-tooltip></el-table-column>
                </el-table>
                <el-pagination v-if="isPaging2"  @size-change="handleSizeChange2" @current-change="handleCurrentChange2" :current-page.sync="currentPage3" :current-page="pageIndex2"  :page-size="pageSize2" layout="total, sizes, prev, pager, next, jumper" :page-count="totalPage2" :total="totalNumber2"></el-pagination>
            </el-tab-pane>
        </el-tabs>
        <!--新增供货替换组-->
        <el-dialog :title="nowLangue.newSupplySwitch" :visible.sync="addVisible" size="large" :lock-scroll="false">
            <div class="marginBot abs">
                <!--保存-->
                <el-button class="bolder outsideBtnBS" size="mini" type="danger" v-text="nowLangue.save" :disabled="saveAddDisabled" @click="hadleAddSave(10,false)"></el-button>
                <!--确定-->
                <el-button class="bolder outsideBtnBS" size="mini" type="danger" v-text="nowLangue.determine" :disabled="saveAddDisabled" @click="handleAddConfirm(20,true)"></el-button>
            </div>
            <el-form :inline="true" :model="createGReplacementForm" ref="createGReplacementForm" class="demo-form-inline">
                <!--法人名称-->
                <el-form-item :label="nowLangue.legalName" class="selectMB10">
                    <el-input size="mini" v-if="legalPersonDropDown.length == 1" disabled v-model="createGReplacementForm.legalPersonName" placeholder=""></el-input>
                    <el-select size="mini" v-else v-model="createGReplacementForm.legalPersonId" @change="changeLegalPerson">
                        <el-option v-for="(legalPerson,index) in legalPersonDropDown" :key="index" :label="legalPerson.legalPersonName" :value="legalPerson.id"></el-option>
                    </el-select>
                </el-form-item>
                <!--供货替换组编码-->
                <el-form-item :label="nowLangue.supplyReplaceGroupCode" class="selectMB10">
                    <el-input size="mini" v-model="createGReplacementForm.code" type="text" disabled></el-input>
                </el-form-item>
                <!--创建人-->
                <el-form-item :label="nowLangue.creator" class="selectMB10">
                    <el-input size="mini" v-model="createGReplacementForm.createUserName" type="text"  disabled></el-input>
                </el-form-item>
                <!--创建时间-->
                <el-form-item :label="nowLangue.createTime" class="selectMB10">
                    <el-input size="mini" v-model="createGReplacementForm.createTime" type="text" disabled></el-input>
                </el-form-item>
                <!--产品线-->
                <el-form-item :label="nowLangue.productLine" prop="productLine" :rules="[{ required: true, message: '产品线不能为空'}]" class="selectMB10">
                    <el-select size="mini" :placeholder="nowLangue.pleaseSelect" v-model="createGReplacementForm.productLine" @change="selectProductline">
                        <el-option v-for="(product,index) in productLineList" :key="index" :label="product.label" :value="product.value"></el-option>
                    </el-select>
                </el-form-item>
                <!--计划大类-->
                <el-form-item :label="nowLangue.planBigClass" prop="planCategoryCode" :rules="[{ required: true, message: '计划大类不能为空'}]" class="selectMB10">
                    <el-select size="mini" :placeholder="nowLangue.pleaseSelect" v-model="createGReplacementForm.planCategoryCode" @change="selectPlanCategoryCode">
                        <el-option v-for="(planCategory,index) in planCategoryList" :key="index" :label="planCategory.name" :value="planCategory.code"></el-option>
                    </el-select>
                </el-form-item>
                <!--供货替换组名称-->
                <el-form-item :label="nowLangue.supplyReplaceGroupName" prop="name" :rules="[{ required: true, message: '供货替换组名称不能为空'}]" class="selectMB10">
                    <el-input size="mini" v-model="createGReplacementForm.name" type="text" :placeholder="nowLangue.pleaseImport+nowLangue.supplyReplaceGroupName"></el-input>
                </el-form-item>
                <!--分库库存分配原则-->
                <el-form-item :label="nowLangue.subTreasury" prop="dcinvalloprinciple" :rules="[{ required: true, message: '分库库存分配原则不能为空'}]" class="selectMB10">
                    <el-select size="mini" :placeholder="nowLangue.pleaseSelect" v-model="createGReplacementForm.dcinvalloprinciple">
                        <el-option v-for="(dcinvalloprinciple,index) in dcinvalloprincipleList" :key="index" :label="dcinvalloprinciple.label" :value="dcinvalloprinciple.value"></el-option>
                    </el-select>
                </el-form-item>
                <!--组内库存分配原则-->
                <el-form-item :label="nowLangue.groupTreasury" prop="clusterinvalloprinciple" :rules="[{ required: true, message: '组内库存分配原则不能为空'}]" class="selectMB10">
                    <el-select size="mini" :placeholder="nowLangue.pleaseSelect" v-model="createGReplacementForm.clusterinvalloprinciple">
                        <el-option v-for="(clusterinvalloprinciple,index) in clusterinvalloprincipleList" :key="index" :label="clusterinvalloprinciple.label" :value="clusterinvalloprinciple.value"></el-option>
                    </el-select>
                </el-form-item>
                <!--允许欠货天数inputOweDays-->
                <el-form-item :label="nowLangue.admitOweDays" prop="oweDays" :rules="[{ required: true, message: '允许欠货天数不能为空'}]" class="selectMB10">
                    <el-input size="mini" v-model="createGReplacementForm.oweDays" type="text" :placeholder="nowLangue.pleaseImport+nowLangue.admitOweDays" @change="inputNumber"></el-input>
                </el-form-item>
            </el-form>
            <div>
                <!--成员列表-->
                <label class="default-label" v-text="nowLangue.memberList"></label>
                <!--添加备件-->
                <!--<el-button class="bolder outsideBtnBS disabled" size="mini" type="danger" v-text="nowLangue.addSpare" v-if="createGReplacementForm.planCategoryCode"></el-button> v-else  -->
                <el-button class="bolder outsideBtnBS" size="mini" type="danger" @click="handleAddSpare" v-text="nowLangue.addSpare"></el-button>
                <!--设置采购优先级-->
                <el-button class="bolder outsideBtnBS" size="mini" type="danger" v-if="memberListData.length" @click="setPurPriority" v-text="nowLangue.setBuyGread"></el-button>
                <el-button class="bolder outsideBtnBS" size="mini" type="danger" v-else disabled v-text="nowLangue.setBuyGread"></el-button>
            </div>
            <el-table :data="memberListData" border style="width: 100%;" v-loading.body="loading3" :element-loading-text="nowLangue.isLoading"><!--拼命加载中-->
                <!--序-->
                <el-table-column type="index" header-align="center" align="center" :label="nowLangue.sequence" width="40"></el-table-column>
                <!--操作-->
                <el-table-column :label="nowLangue.operate" header-align="center" align="center" width="200">
                    <template scope="scope">
                        <!--删除-->
                        <div class="operationItem bolder" v-text="nowLangue.delete"  @click="handleDel(scope.$index, memberListData)"></div>
                        <!--设置备件替换链-->
                        <div class="operationItem bolder" v-text="nowLangue.setSpareStwich" @click="setDisPriority(scope.$index,scope.row)" ></div>
                    </template>
                </el-table-column>
                <!--产品线-->
                <el-table-column prop="productLineName" :label="nowLangue.productLine" header-align="center" show-overflow-tooltip></el-table-column>
                <!--计划大类-->
                <el-table-column prop="planCategoryName" :label="nowLangue.planBigClass" header-align="center" show-overflow-tooltip></el-table-column>
                <!--备件编码-->
                <el-table-column prop="materialCode" :label="nowLangue.spareCode" header-align="center"  show-overflow-tooltip></el-table-column>
                <!--备件名称-->
                <el-table-column prop="materialName" :label="nowLangue.spareName" header-align="center"  show-overflow-tooltip></el-table-column>
                <!--押款价-->
                <el-table-column prop="yaKuanPrice" :label="nowLangue.signatureMoney" header-align="center"  show-overflow-tooltip ></el-table-column>
                <!--成本价-->
                <el-table-column prop="price" :label="nowLangue.costMoney" header-align="center"  show-overflow-tooltip ></el-table-column>
                <!--状态-->
                <el-table-column prop="statusName" :label="nowLangue.status" header-align="center"  show-overflow-tooltip></el-table-column>
                <!--Topmost-->
                <el-table-column prop="topmost" :label="nowLangue.Topmost" header-align="center" align="center"  show-overflow-tooltip>
                    <template scope="scope">
                        <el-radio v-model="defaultPriority" :label="scope.row.materialCode" size="mini">&nbsp;</el-radio>
                    </template>
                </el-table-column>
                <!--采购优先级-->
                <el-table-column prop="priority" :label="nowLangue.buyGread" header-align="center"  show-overflow-tooltip></el-table-column>
                <!--<el-table-column prop="priority" label="配货优先级" header-align="center"  show-overflow-tooltip width="160"></el-table-column>-->
                <!--序列化标志-->
                <el-table-column prop="serializableName" :label="nowLangue.serializeSign" header-align="center"  show-overflow-tooltip ></el-table-column>
                <!--是否可借用-->
                <el-table-column prop="borrowableName" :label="nowLangue.isLend" header-align="center"  show-overflow-tooltip width="160"></el-table-column>
                <!--是否可销售-->
                <el-table-column prop="lenovoSellableName" :label="nowLangue.isSale" header-align="center"  show-overflow-tooltip ></el-table-column>
                <!--默认索赔商-->
                <el-table-column prop="supplierName" :label="nowLangue.defaultClaimMaker" header-align="center"  show-overflow-tooltip width="160"></el-table-column>
            </el-table>
        </el-dialog>
        <!--修改供货替换关系-->
        <el-dialog :title="nowLangue.updateSupplySwitch" :visible.sync="updateVisible" size="large" :lock-scroll="false">
            <div class="marginBot abs">
                <el-button class="bolder outsideBtnBS" size="mini" type="danger" v-text="nowLangue.save" :disabled="updateAddDisabled" @click="handleUpdateSave(10,false)"><!--保存--></el-button>
                <el-button class="bolder outsideBtnBS" size="mini" type="danger" v-text="nowLangue.determine" :disabled="updateAddDisabled" @click="handleUpdateConfirm(20,true)"><!--确定--></el-button>
            </div>
            <el-form :inline="true" :model="updateGReplacementForm" ref="updateGReplacementForm" class="demo-form-inline">
                <!--法人名称-->
                <el-form-item :label="nowLangue.legalName" class="selectMB10">
                    <el-input size="mini" disabled v-model="updateGReplacementForm.legalPersonName" placeholder=""></el-input>
                </el-form-item>
                <!--供货替换组编码-->
                <el-form-item :label="nowLangue.supplyReplaceGroupCode" class="selectMB10">
                    <el-input size="mini" v-model="updateGReplacementForm.code" type="text" disabled></el-input>
                </el-form-item>
                <!--创建人-->
                <el-form-item :label="nowLangue.creator" class="selectMB10">
                    <el-input size="mini" v-model="updateGReplacementForm.createUserName" type="text" disabled></el-input>
                </el-form-item>
                <!--创建时间-->
                <el-form-item :label="nowLangue.createTime" class="selectMB10">
                    <el-input size="mini" v-model="updateGReplacementForm.createTime" type="text" disabled></el-input>
                </el-form-item>
                <!--产品线-->
                <el-form-item :label="nowLangue.productLine" class="selectMB10">
                    <el-input size="mini" v-model="updateGReplacementForm.productLineName" type="text" disabled></el-input>
                    <!--<el-select size="mini" v-model="updateGReplacementForm.productLine">
                        <el-option v-for="(product,index) in productLineList" :key="index" :label="product.label" :value="product.value"></el-option>
                    </el-select>-->
                </el-form-item>
                <!--计划大类-->
                <el-form-item :label="nowLangue.planBigClass" class="selectMB10">
                    <el-input size="mini" v-model="updateGReplacementForm.planCategoryName" type="text" disabled></el-input>
                    <!-- 
                    <el-select size="mini" v-model="updateGReplacementForm.planCategoryCode" disabled>
                        <el-option v-for="(planCategory,index) in planCategoryList" :key="index" :label="planCategory.name" :value="planCategory.code"></el-option>
                    </el-select>-->
                </el-form-item>
                <!--供货替换组名称-->
                <el-form-item :label="nowLangue.supplyReplaceGroupName" class="selectMB10">
                    <el-input size="mini" v-model="updateGReplacementForm.name" type="text" :placeholder="nowLangue.pleaseImport+nowLangue.supplyReplaceGroupName"></el-input>
                </el-form-item>
                <!--分库库存分配原则-->
                <el-form-item :label="nowLangue.subTreasury" prop="dcinvalloprinciple" :rules="[{ required: true, message: '分库库存分配原则不能为空'}]" class="selectMB10">
                    <el-select size="mini" :placeholder="nowLangue.pleaseSelect" v-model="updateGReplacementForm.dcinvalloprinciple">
                        <el-option v-for="(dcinvalloprinciple,index) in dcinvalloprincipleList" :key="index" :label="dcinvalloprinciple.label" :value="dcinvalloprinciple.value"></el-option>
                    </el-select>
                </el-form-item>
                <!--组内库存分配原则-->
                <el-form-item :label="nowLangue.groupTreasury" prop="clusterinvalloprinciple" :rules="[{ required: true, message: '组内库存分配原则不能为空'}]" class="selectMB10">
                    <el-select size="mini" :placeholder="nowLangue.pleaseSelect" v-model="updateGReplacementForm.clusterinvalloprinciple">
                        <el-option v-for="(clusterinvalloprinciple,index) in clusterinvalloprincipleList" :key="index" :label="clusterinvalloprinciple.label" :value="clusterinvalloprinciple.value"></el-option>
                    </el-select>
                </el-form-item>
                <!--允许欠货天数inputOweDays-->
                <el-form-item :label="nowLangue.admitOweDays" prop="oweDays" :rules="[{ required: true, message: '允许欠货天数不能为空'}]" class="selectMB10">
                    <el-input size="mini" v-model="updateGReplacementForm.oweDays" type="text" :placeholder="nowLangue.pleaseImport+nowLangue.admitOweDays" @change="inputNumber"></el-input>
                </el-form-item>
            </el-form>
            <div>
                <!--成员列表-->
                <label class="default-label" v-text="nowLangue.memberList"></label>
                <!--添加备件-->
                <el-button class="bolder outsideBtnBS" size="mini" type="danger" @click="handleUpdateAddSpare" v-text="nowLangue.addSpare"></el-button>
                <!--设置采购优先级-->
                <el-button class="bolder outsideBtnBS" size="mini" type="danger" v-if="updateSpareData.length" @click="setPurPriority" v-text="nowLangue.setBuyGread"></el-button>
                <el-button class="bolder outsideBtnBS" size="mini" type="danger" v-else disabled v-text="nowLangue.setBuyGread"></el-button>
            </div>
            <el-table :data="updateSpareData" border style="width: 100%;" v-loading.body="loading4" :element-loading-text="nowLangue.isLoading">
                <!--序-->
                <el-table-column type="index" header-align="center" align="center" :label="nowLangue.sequence" width="40"></el-table-column>
                <!--操作-->
                <el-table-column :label="nowLangue.operate" header-align="center" align="center" width="180">
                    <template scope="scope">
                        <!--删除-->
                        <div class="operationItem bolder" v-text="nowLangue.delete"  @click="handleDel(scope.$index, updateSpareData)"></div>
                        <!--设置备件替换链-->
                        <div class="operationItem bolder" v-text="nowLangue.setSpareStwich" @click="setDisPriority(scope.$index,scope.row)" ></div>
                    </template>
                </el-table-column>
                <!--产品线-->
                <el-table-column prop="productLineName" :label="nowLangue.productLine" header-align="center" show-overflow-tooltip></el-table-column>
                <!--计划大类-->
                <el-table-column prop="planCategoryName" :label="nowLangue.planBigClass" header-align="center" show-overflow-tooltip></el-table-column>
                <!--备件编码-->
                <el-table-column prop="materialCode" :label="nowLangue.spareCode" header-align="center"  show-overflow-tooltip></el-table-column>
                <!--备件名称-->
                <el-table-column prop="materialName" :label="nowLangue.spareName" header-align="center"  show-overflow-tooltip></el-table-column>
                <!--押款价-->
                <el-table-column prop="yaKuanPrice" :label="nowLangue.signatureMoney" header-align="center"  show-overflow-tooltip ></el-table-column>
                <!--成本价-->
                <el-table-column prop="price" :label="nowLangue.costMoney" header-align="center"  show-overflow-tooltip ></el-table-column>
                <!--状态-->
                <el-table-column prop="statusName" :label="nowLangue.status" header-align="center"  show-overflow-tooltip></el-table-column>
                <!--Topmost-->
                <el-table-column prop="topmost" :label="nowLangue.Topmost" header-align="center"  align="center" show-overflow-tooltip>
                    <template scope="scope">
                        <el-radio v-model="defaultPriority" :label="scope.row.materialCode" size="mini">&nbsp;</el-radio>
                    </template>
                </el-table-column>
                <!--采购优先级-->
                <el-table-column prop="priority" :label="nowLangue.buyGread" header-align="center"  show-overflow-tooltip></el-table-column>
                <!--配货优先级
                <el-table-column prop="priority" :label="nowLangue.prepareGread" header-align="center"  show-overflow-tooltip width="160"></el-table-column>-->
                <!--序列化标志-->
                <el-table-column prop="serializableName" :label="nowLangue.serializeSign" header-align="center"  show-overflow-tooltip ></el-table-column>
                <!--是否可借用-->
                <el-table-column prop="borrowableName" :label="nowLangue.isLend" header-align="center"  show-overflow-tooltip width="160"></el-table-column>
                <!--是否可销售-->
                <el-table-column prop="lenovoSellableName" :label="nowLangue.isSale" header-align="center"  show-overflow-tooltip ></el-table-column>
                <!--默认索赔商-->
                <el-table-column prop="supplierName" :label="nowLangue.defaultClaimMaker" header-align="center"  show-overflow-tooltip width="160"></el-table-column>
            </el-table>
        </el-dialog>
        <!--查看供货替换关系-->
        <el-dialog :title="nowLangue.seeSupplySwitch" :visible.sync="seeVisible" size="large" :lock-scroll="false">
            <el-form :inline="true" :model="seeGReplacementForm" ref="seeGReplacementForm" class="demo-form-inline">
                <!--法人名称-->
                <el-form-item :label="nowLangue.legalName" class="selectMB10">
                    <el-input size="mini" disabled v-model="seeGReplacementForm.legalPersonName"></el-input>
                </el-form-item>
                <!--供货替换组编码-->
                <el-form-item :label="nowLangue.supplyReplaceGroupCode" class="selectMB10">
                    <el-input size="mini" v-model="seeGReplacementForm.code" type="text" disabled></el-input>
                </el-form-item>
                <!--创建人-->
                <el-form-item :label="nowLangue.creator" class="selectMB10">
                    <el-input size="mini" v-model="seeGReplacementForm.createUserName" type="text"  disabled></el-input>
                </el-form-item>
                <!--创建时间-->
                <el-form-item :label="nowLangue.createTime" class="selectMB10">
                    <el-input size="mini" v-model="seeGReplacementForm.createTime" type="text" disabled></el-input>
                </el-form-item>
                <!--产品线-->
                <el-form-item :label="nowLangue.productLine" class="selectMB10">
                    <el-input size="mini" v-model="seeGReplacementForm.productLine" type="text" disabled></el-input>
                </el-form-item>
                <!--计划大类-->
                <el-form-item :label="nowLangue.planBigClass" class="selectMB10">
                    <el-input size="mini" v-model="seeGReplacementForm.planCategoryCode" type="text" disabled></el-input>
                </el-form-item>
                <!--供货替换组名称-->
                <el-form-item :label="nowLangue.supplyReplaceGroupName" class="selectMB10">
                    <el-input size="mini" v-model="seeGReplacementForm.name" type="text" disabled></el-input>
                </el-form-item>
                <!--分库库存分配原则-->
                <el-form-item :label="nowLangue.subTreasury" class="selectMB10">
                    <el-input size="mini" v-model="seeGReplacementForm.dcinvalloprincipleName" type="text" disabled></el-input>
                </el-form-item>
                <!--组内库存分配原则-->
                <el-form-item :label="nowLangue.groupTreasury" class="selectMB10">
                    <el-input size="mini" v-model="seeGReplacementForm.clusterinvalloprincipleName" type="text" disabled></el-input>
                </el-form-item>
                <!--允许欠货天数-->
                <el-form-item :label="nowLangue.admitOweDays" class="selectMB10">
                    <el-input size="mini" v-model="seeGReplacementForm.oweDays" type="text" :placeholder="nowLangue.pleaseImport+nowLangue.admitOweDays" disabled></el-input>
                </el-form-item>
            </el-form>
            <div>
                <!--成员列表-->
                <label class="default-label" v-text="nowLangue.memberList"></label>
                <!--备件配货替换链
                <el-button class="bolder outsideBtnBS" size="mini" type="danger" @click="setDisPriority(1)" v-text="nowLangue.sparePrepareSwitch"></el-button>-->
            </div>
            <el-table :data="seeSpareData" border style="width: 100%;" v-loading.body="loading5" :element-loading-text="nowLangue.isLoading">
                <!--序-->
                <el-table-column type="index" header-align="center" align="center" :label="nowLangue.sequence" width="40"></el-table-column>
                <!--操作-->
                <el-table-column :label="nowLangue.operate" header-align="center" align="center"  width="120">
                    <template scope="scope">
                        <!--备件配货替换链-->
                        <div class="operationItem bolder" v-text="nowLangue.sparePrepareSwitch"  @click="setDisPriority(scope.$index,scope.row,1)"></div>
                    </template>
                </el-table-column>
                <!--产品线-->
                <el-table-column prop="productLineName" :label="nowLangue.productLine" header-align="center" show-overflow-tooltip></el-table-column>
                <!--计划大类-->
                <el-table-column prop="planCategoryName" :label="nowLangue.planBigClass" header-align="center" show-overflow-tooltip></el-table-column>
                <!--备件编码-->
                <el-table-column prop="materialCode" :label="nowLangue.spareCode" header-align="center"  show-overflow-tooltip></el-table-column>
                <!--备件名称-->
                <el-table-column prop="materialName" :label="nowLangue.spareName" header-align="center"  show-overflow-tooltip></el-table-column>
                <!--押款价-->
                <el-table-column prop="yaKuanPrice" :label="nowLangue.signatureMoney" header-align="center"  show-overflow-tooltip ></el-table-column>
                <!--成本价-->
                <el-table-column prop="price" :label="nowLangue.costMoney" header-align="center"  show-overflow-tooltip ></el-table-column>
                <!--状态-->
                <el-table-column prop="statusName" :label="nowLangue.status" header-align="center"  show-overflow-tooltip></el-table-column>
                <!--Topmost-->
                <el-table-column prop="topmost" :label="nowLangue.Topmost" header-align="center"  align="center" show-overflow-tooltip>
                    <template scope="scope">
                        <el-radio v-model="defaultPriority" :label="scope.row.materialCode" size="mini" disabled>&nbsp;</el-radio>
                    </template>
                </el-table-column>
                <!--采购优先级-->
                <el-table-column prop="priority" :label="nowLangue.buyGread" header-align="center"  show-overflow-tooltip></el-table-column>
                <!--配货优先级
                <el-table-column prop="priority" :label="nowLangue.prepareGread" header-align="center"  show-overflow-tooltip width="160"></el-table-column>-->
                <!--序列化标志-->
                <el-table-column prop="serializableName" :label="nowLangue.serializeSign" header-align="center"  show-overflow-tooltip ></el-table-column>
                <!--是否可借用-->
                <el-table-column prop="borrowableName" :label="nowLangue.isLend" header-align="center"  show-overflow-tooltip width="160"></el-table-column>
                <!--是否可销售-->
                <el-table-column prop="lenovoSellableName" :label="nowLangue.isSale" header-align="center"  show-overflow-tooltip ></el-table-column>
                <!--默认索赔商-->
                <el-table-column prop="supplierName" :label="nowLangue.defaultClaimMaker" header-align="center"  show-overflow-tooltip width="160"></el-table-column>
            </el-table>
        </el-dialog>
        <!--添加备件-->
        <el-dialog :title="nowLangue.addSpare" :visible.sync="spareVisible" :lock-scroll="false">
            <el-form :inline="true" :model="addSpareForm" ref="addSpareForm" class="demo-form-inline">
                <div>
                    <div class="dayChose" style="display: block">
                        <el-form-item>
                            <!--按工程替换组添加-->
                            <el-radio :label="1" v-model="addSpareForm.radio" v-cloak>{{nowLangue.addByProduct}}</el-radio>
                        </el-form-item>
                        <div v-if="addSpareForm.radio==1">
                            <el-form-item label="" class="selectMB10" >
                                <!--添加-->
                                <el-button class="bolder outsideBtnBS selectAll"  size="mini" type="danger" v-text="nowLangue.add" @click="handleSRGAdd"></el-button>
                            </el-form-item>
                        </div>
                    </div>
                    <div class="dayChose" style="display: block">
                        <el-form-item>
                            <!--按备件添加-->
                            <el-radio :label="2" v-model="addSpareForm.radio" v-cloak>{{nowLangue.addBySpare}}</el-radio>
                        </el-form-item>
                        <div v-if="addSpareForm.radio==2">
                            <el-form-item label="" class="selectMB10" >
                                <!--添加-->
                                <el-button class="bolder outsideBtnBS selectAll"  size="mini" type="danger"  v-text="nowLangue.add" @click="handleSpareAdd"></el-button>
                            </el-form-item>
                        </div>
                    </div>
                </div>
                <!--工程替换组编码-->
                <el-form-item :label="nowLangue.productReplaceGroupCode" class="selectMB10" v-if="addSpareForm.radio==1">
                    <el-input size="mini" v-model="addSpareForm.code" type="text" :placeholder="nowLangue.pleaseImport+nowLangue.productReplaceGroupCode"></el-input>
                </el-form-item>
                <!--备件编码-->
                <el-form-item :label="nowLangue.spareCode" class="selectMB10" v-else>
                    <el-input size="mini" v-model="addSpareForm.materialCode" type="text" :placeholder="nowLangue.pleaseImport+nowLangue.spareCode"></el-input>
                </el-form-item>
                <el-form-item label="">
                    <!--查询-->
                    <el-button v-if="addSpareForm.radio==1" style="margin-left:5px!important;" class="bolder outsideBtnBS selectAll"  size="mini" type="danger" v-text="nowLangue.query" @click="querySpareList"></el-button>
                    <el-button v-else style="margin-left:5px!important;" class="bolder outsideBtnBS selectAll"  size="mini" type="danger" v-text="nowLangue.query" @click="querySpare2List"></el-button>
                </el-form-item>
            </el-form>
            <div v-if="addSpareForm.radio==1">
                <el-table  :data="spareListData" border style="width: 100%;" ref="multipleTable" @selection-change="handleSelectedSpareList">
                    <!--序-->
                    <el-table-column type="index" header-align="center" align="center" :label="nowLangue.sequence" width="40"></el-table-column>
                    <el-table-column type="selection" align="center" width="40"></el-table-column>
                    <!--工程替换组编码-->
                    <el-table-column prop="code" :label="nowLangue.productReplaceGroupCode" header-align="center" show-overflow-tooltip></el-table-column>
                    <!--备件编码-->
                    <el-table-column prop="materialCode" :label="nowLangue.spareCode" header-align="center" show-overflow-tooltip></el-table-column>
                    <!--备件名称-->
                    <el-table-column prop="materialName" :label="nowLangue.spareName" header-align="center"  show-overflow-tooltip></el-table-column>
                </el-table>
            </div>
            <div v-if="addSpareForm.radio==2">
                <el-table :data="spare2ListData" border style="width: 100%;" ref="multiple2Table" @selection-change="selectedSpare2List">
                    <!--序-->
                    <el-table-column type="index" header-align="center" align="center" :label="nowLangue.sequence" width="40"></el-table-column>
                    <el-table-column type="selection" align="center" width="40"></el-table-column>
                    <!--备件编码-->
                    <el-table-column prop="materialCode" :label="nowLangue.spareCode" header-align="center" show-overflow-tooltip></el-table-column>
                    <!--备件名称-->
                    <el-table-column prop="materialName" :label="nowLangue.spareName" header-align="center"  show-overflow-tooltip></el-table-column>
                </el-table>
            </div>
        </el-dialog>
        <!--设置采购优先级-->
        <el-dialog :title="nowLangue.setBuyGread" :visible.sync="purVisible" :lock-scroll="false">
            <div class="marginBot abs">
                <!--确定-->
                <el-button class="bolder outsideBtnBS" size="mini" type="danger" v-text="nowLangue.determine" @click="handleSBGConfirm"></el-button>
            </div>
            <el-table max-height="400" :data="purchaseData" border style="width: 100%;" v-loading.body="loading8" :element-loading-text="nowLangue.isLoading">
                <!--序-->
                <el-table-column type="index" header-align="center" align="center" :label="nowLangue.sequence" width="40"></el-table-column>
                <!--备件编码-->
                <el-table-column prop="materialCode" :label="nowLangue.spareCode" header-align="center" show-overflow-tooltip></el-table-column>
                <!--备件名称-->
                <el-table-column prop="materialName" :label="nowLangue.spareName" header-align="center"  show-overflow-tooltip></el-table-column>
                <!--修改前采购优先级-->
                <el-table-column prop="oldPriority" :label="nowLangue.oldBuyGread" header-align="center"  show-overflow-tooltip></el-table-column>
                <!--修改后采购优先级inputPriority-->
                <el-table-column prop="priority" :label="nowLangue.newBuyGread" header-align="center" show-overflow-tooltip>
                    <template scope="scope">
                        <el-input size="mini" :placeholder="nowLangue.pleaseImport"  v-model="scope.row.priority" @change="inputNumber(scope.row.priority)"></el-input>
                    </template>
                </el-table-column>
            </el-table>
        </el-dialog>
        <!--设置备件替换链-->
        <el-dialog :title="nowLangue.setSpareStwich" :visible.sync="disVisible" :lock-scroll="false">
            <div class="marginBot abs"  v-if="!seeFlag">
                <!--确定-->
                <el-button class="bolder outsideBtnBS" size="mini" type="danger" v-text="nowLangue.determine" @click="handleSSSConfirm"></el-button>
            </div>
            <!--备件信息：-->
            <label class="default-label" v-text="nowLangue.spareInfor"></label>
            <el-table max-height="100" :data="spareMSGData" border style="width: 100%;" v-loading.body="loading9" :element-loading-text="nowLangue.isLoading">
                <!--备件编码-->
                <el-table-column prop="materialCode" :label="nowLangue.spareCode" header-align="center" show-overflow-tooltip></el-table-column>
                <!--备件名称-->
                <el-table-column prop="materialName" :label="nowLangue.spareName" header-align="center"  show-overflow-tooltip></el-table-column>
                <!--备件押款价-->
                <el-table-column prop="yakuanPrice" :label="nowLangue.spareSignatureMoney" header-align="center" show-overflow-tooltip></el-table-column>
            </el-table>
            <!--替换备件列表：-->
            <label class="default-label" v-text="nowLangue.switchSpareList"><!--替换备件列表：--></label>
            <el-table max-height="100" :data="distributionData" border style="width: 100%;" v-loading.body="loading10" :element-loading-text="nowLangue.isLoading">
                <!--序-->
                <el-table-column type="index" header-align="center" align="center" :label="nowLangue.sequence" width="40"></el-table-column>
                <!--操作-->
                <el-table-column :label="nowLangue.operate" header-align="center" align="center" width="50" v-if="!seeFlag">
                    <template scope="scope">
                        <!--删除-->
                        <div class="operationItem bolder" v-text="nowLangue.delete"  @click="handleDel(scope.$index, distributionData)"></div>
                    </template>
                </el-table-column>
                <!--替换备件编码-->
                <el-table-column prop="subMaterialCode" :label="nowLangue.switchSpareCode" header-align="center" show-overflow-tooltip></el-table-column>
                <!--替换备件名称-->
                <el-table-column prop="subMaterialName" :label="nowLangue.switchSpareName" header-align="center"  show-overflow-tooltip></el-table-column>
                <!--备件押款价-->
                <el-table-column prop="yakuanPrice" :label="nowLangue.spareSignatureMoney" header-align="center" show-overflow-tooltip></el-table-column>
                <!--配货优先级inputDistributionPriority-->
                <el-table-column prop="priority" :label="nowLangue.prepareGread" header-align="center" show-overflow-tooltip v-if="!seeFlag">
                    <template scope="scope">
                        <el-input size="mini" :placeholder="nowLangue.pleaseImport" v-model="scope.row.priority" @change="inputNumber(scope.row.priority)"></el-input>
                    </template>
                </el-table-column>
                <el-table-column prop="priority" :label="nowLangue.prepareGread" header-align="center" show-overflow-tooltip v-else></el-table-column>
            </el-table>
            <!--工程替换关系：-->
            <label class="default-label" v-text="nowLangue.productSwitch"></label>
            <el-table max-height="100" :data="cReplaceData" border style="width: 100%;" v-loading.body="loading11" :element-loading-text="nowLangue.isLoading">
                <!--序-->
                <el-table-column type="index" header-align="center" align="center" :label="nowLangue.sequence" width="40"></el-table-column>
                <!--操作-->
                <el-table-column :label="nowLangue.operate" header-align="center" align="center" width="50" v-if="!seeFlag">
                    <template scope="scope">
                        <!--添加-->
                        <div class="operationItem bolder" v-text="nowLangue.add" @click="handleAddCR(scope.$index, scope.row)"></div>
                    </template>
                </el-table-column>
                <!--替换备件编码-->
                <el-table-column prop="subMaterialCode" :label="nowLangue.switchSpareCode" header-align="center" show-overflow-tooltip></el-table-column>
                <!--替换备件名称-->
                <el-table-column prop="subMaterialName" :label="nowLangue.switchSpareName" header-align="center"  show-overflow-tooltip></el-table-column>
                <!--备件押款价-->
                <el-table-column prop="yakuanPrice" :label="nowLangue.spareSignatureMoney" header-align="center" show-overflow-tooltip></el-table-column>
            </el-table>
        </el-dialog>
    </div>
</template>

<script>
    export default {
        data() {
            return {
                language:{
                    zh:{
                        "sel":"选择",
                        "newSupplySwitch":"新增供货替换关系",
                        "updateSupplySwitch":"修改供货替换关系",
                        "seeSupplySwitch":"查看供货替换关系",
                        "save":"保存",
                        "determine":"确定",
                        "supplyReplaceGroupCode":"供货替换组编码",
                        "supplyReplaceGroupName":"供货替换组名称",
                        "creator":"创建人",
                        "createTime":"创建时间",
                        "updater":"修改人",
                        "updateTime":"最后修改时间",
                        "legalName":"法人名称",
                        "productLine":"产品线",
                        "planBigClass":"计划大类",
                        "pleaseSelect":"请选择",
                        "pleaseImport":"请输入",
                        "subTreasury":"分库库存分配原则",
                        "groupTreasury":"组内库存分配原则",
                        "admitOweDays":"允许欠货天数",
                        "memberList":"成员列表",
                        "addSpare":"添加备件",
                        "setBuyGread":"设置采购优先级",
                        "setSpareStwich":"设置备件替换链",
                        "isLoading":"正在拼命加载中",
                        "sequence":"序",
                        "select":"选择",
                        "operate":"操作",
                        "delete":"删除",
                        "spareCode":"备件编码",
                        "spareName":"备件名称",
                        "switchSpareCode":"替换备件编码",
                        "switchSpareName":"替换备件名称",
                        "signatureMoney":"押款价",
                        "costMoney":"成本价",
                        "status":"状态",
                        "Topmost":"Topmost",
                        "buyGread":"采购优先级",
                        "oldBuyGread":"修改前采购优先级",
                        "newBuyGread":"修改后采购优先级",
                        "prepareGread":"配货优先级",
                        "serializeSign":"序列化标志",
                        "defaultClaimMaker":"默认索赔商",
                        "isLend":"是否可借用",
                        "isSale":"是否可销售",
                        "sparePrepareSwitch":"备件配货替换链",
                        "addByProduct":"按工程替换组添加",
                        "add":"添加",
                        "addBySpare":"按备件添加",
                        "productReplaceGroupCode":"工程替换组编码",
                        "productReplaceGroupName":"工程替换组名称",
                        "query":"查询",
                        "spareInfor":"备件信息",
                        "spareSignatureMoney":"备件押款价",
                        "switchSpareList":"替换备件列表",
                        "productSwitch":"工程替换关系",
                        "forbidden":"禁用",
                        "enable":"启用",
                        "update":"修改",
                        "check":"查看",
                        "newAdd":"新增",
                        "supplySwitchDetail":"供货替换组明细",
                        "supplySwitch":"供货替换关系",
                        "freeConditionQuery":"自由条件查询",
                        "freeSpareList":"自由备件列表"
                    },
                    en:{
                        "sel":"sel",
                        "newSupplySwitch":"newSupplySwitch",
                        "updateSupplySwitch":"updateSupplySwitch",
                        "seeSupplySwitch":"seeSupplySwitch",
                        "save":"save",
                        "determine":"determine",
                        "supplyReplaceGroupCode":"supplyReplaceGroupCode",
                        "supplyReplaceGroupName":"supplyReplaceGroupName",
                        "creator":"creator",
                        "createTime":"createTime",
                        "updater":"updater",
                        "updateTime":"updateTime",
                        "planBigClass":"planBigClass",
                        "pleaseSelect":"pleaseSelect",
                        "pleaseImport":"pleaseImport",
                        "subTreasury":"subTreasury",
                        "groupTreasury":"groupTreasury",
                        "admitOweDays":"admitOweDays",
                        "memberList":"memberList",
                        "addSpare":"addSpare",
                        "setBuyGread":"setBuyGread",
                        "setSpareStwich":"setSpareStwich",
                        "isLoading":"isLoading",
                        "sequence":"sequence",
                        "select":"select",
                        "operate":"operate",
                        "delete":"delete",
                        "legalName":"legalName",
                        "productLine":"productLine",
                        "spareCode":"spareCode",
                        "spareName":"spareName",
                        "switchSpareCode":"switchSpareCode",
                        "switchSpareName":"switchSpareName",
                        "signatureMoney":"signatureMoney",
                        "costMoney":"costMoney",
                        "status":"status",
                        "Topmost":"Topmost",
                        "buyGread":"buyGread",
                        "oldBuyGread":"oldBuyGread",
                        "newBuyGread":"newBuyGread",
                        "prepareGread":"prepareGread",
                        "serializeSign":"serializeSign",
                        "defaultClaimMaker":"defaultClaimMaker",
                        "isLend":"isLend",
                        "isSale":"isSale",
                        "sparePrepareSwitch":"sparePrepareSwitch",
                        "addByProduct":"addByProduct",
                        "add":"add",
                        "addBySpare":"addBySpare",
                        "productReplaceGroupCode":"productReplaceGroupCode",
                        "productReplaceGroupName":"productReplaceGroupName",
                        "query":"query",
                        "spareInfor":"spareInfor",
                        "spareSignatureMoney":"spareSignatureMoney",
                        "switchSpareList":"switchSpareList",
                        "productSwitch":"productSwitch",
                        "forbidden":"forbidden",
                        "enable":"enable",
                        "update":"update",
                        "check":"check",
                        "newAdd":"newAdd",
                        "supplySwitchDetail":"supplySwitchDetail",
                        "supplySwitch":"supplySwitch",
                        "freeConditionQuery":"freeConditionQuery",
                        "freeSpareList":"freeSpareList"
                    }
                },
                nowLangue:{},
                activeName: '1',
                legalPersonDropDown:[], // 法人名称集合
                productLineList:[],//产品线集合
                statusList:[],   //启用禁用集合
                planCategoryList:[],//计划大类集合
                dcinvalloprincipleList:[],   // 分库库存分配原则
                clusterinvalloprincipleList:[],  //组内库存分配原则
                // 查询表单
                supplyRUForm:{
                    active: "",
                    code: "",
                    name: "",
                    materialCode: "",
                    planCategoryCode: "",
                    productLine: ""
                },
                loading:false,
                isPaging:true,    //是否显示分页
                pageIndex:1,    //当前页（必传）
                pageSize:10,   //每页多少条
                currentPage:1,    //当前显示3页
                totalNumber: 1,     //总条数
                totalPage:1,    //总页数
                supplyRUData:[],  //供货替换组明细
                memberListData:[],//成员列表
                updateSpareData:[],//修改列表
                seeSpareData:[],//查看成员列表
                spareListData:[],//备件列表
                spare2ListData:[], //备件列表
                selectedSpare2ListData:[], // 选中的备件列表
                purchaseData:[],//设置采购优先级列表
                spareMSGData:[],  //备件信息
                distributionData:[],//替换备件列表：
                cReplaceData:[],  //工程替换关系
                // 查询表单
                freeSpareForm:{
                    materialCode: "",
                    planCategoryCode: "",
                    productLine: ""
                },
                loading2:false,
                // 分页
                isPaging2:true,    //是否显示分页
                pageIndex2:1,    //当前页（必传）
                pageSize2:10,   //每页多少条
                currentPage3:3,//当前显示3页
                totalNumber2: 1,     //总条数
                totalPage2:1,    //总页数
                freeSpareData:[],//自由备件列表
                addSpareForm:{
                    radio:1,
                    code:""
                },
                selectedSpareListData:[],//添加备件弹窗中选中的工程组
                addVisible:false,//新增
                createGReplacementForm:{
                    code:"",
                    productLine:"",
                    planCategoryCode:"",
                    name:"",
                    dcinvalloprinciple:"",
                    clusterinvalloprinciple:"",
                    oweDays:""
                },
                clusterCode:"", // 按工程替换组添加 备件  第一个选中的替换组编码中的备件
                updateId:"",  // 修改时的id
                updateVisible:false,//修改
                updateGReplacementForm:{
                    code:"",
                    productLine:"",
                    planCategoryCode:"",
                    name:"",
                    dcinvalloprinciple:"",
                    clusterinvalloprinciple:"",
                    oweDays:""
                },
                seeVisible:false,//查看
                seeGReplacementForm:{
                    code:"",
                    productLine:"",
                    planCategoryCode:"",
                    name:"",
                    dcinvalloprinciple:"",
                    clusterinvalloprinciple:"",
                    oweDays:""
                },
                defaultPriority:"",  //Topmost  
                spareVisible:false,//添加备件
                purVisible:false,//设置采购优先级
                disVisible:false,//设置备件替换链
                disabled:false,
                loading3:false,
                loading4:false,
                loading5:false,
                loading8:false,
                loading9:false,
                loading10:false,
                loading11:false,

                seeFlag:false,//是否通过查看点开弹窗,true是
                //查询禁用
                selectDisabled:false,
                select2Disabled:false,
                saveAddDisabled:false,   //新增的保存、确认操作按钮禁用
                updateAddDisabled:false    //修改的保存、确认操作按钮禁用
            };
        },
        created:function(){
            var _this=this;
            _this.languageType=="zh"?_this.nowLangue=_this.language.zh:_this.nowLangue=_this.language.en;
        },
        computed:{
            languageType(){
                return this.$store.state.languageType;
            }
        },
        watch:{
            languageType(){
                var _this=this;
                _this.languageType=="zh"?_this.nowLangue=_this.language.zh:_this.nowLangue=_this.language.en;
            },
            "addSpareForm.radio":function(){
                var _this = this;
                if(_this.addSpareForm.radio==1){
                    // 按工程替换组添加      查询
                    // _this.querySpareList();    // 输入工程替换组之后，点击查询  才取调取查询接口
                }else{
                    // 按备件添加      查询
                    _this.querySpare2List();
                }
                _this.defaultPriority="";  //Topmost  
                _this.selectedSpareListData=[];  //添加备件弹窗中的    按工程替换组添加操作  清空选中的备件
                _this.selectedSpare2ListData=[];   // 添加备件弹窗中的  按备件添加操作  清空选中的备件
            },
            addVisible(){
                var _this = this;
                _this.legalPersonDropDownValue();  // 法人名称
            },
            updateVisible(){
                var _this = this;
                _this.legalPersonDropDownValue();  // 法人名称
            },
            seeVisible(){
                var _this = this;
                _this.legalPersonDropDownValue();  // 法人名称
            },
            defaultPriority(){   // topmost    默认优先级
                var _this = this;
                if(_this.addVisible){
                    for(var i=0;i<_this.memberListData.length;i++){
                        if(_this.defaultPriority == _this.memberListData[i].materialCode){
                            _this.memberListData[i].topmost=true;
                        }
                    }
                }else if(_this.updateVisible){
                    for(var j=0;j<_this.updateSpareData.length;j++){
                        if(_this.defaultPriority == _this.updateSpareData[j].materialCode){
                            _this.updateSpareData[j].topmost=true;
                        }
                    }
                }
            }
        },
        //进入页面立即运行此方法
        mounted: function () {
            var _this = this;
            _this.$store.commit('currentActive', 'SupplyReplacementUnit');
            _this.legalPersonDropDownValue();  // 法人名称
            _this.getCommonList();//工程管理模块  下拉框公共接口   产品线集合 状态集合
            _this.getPlanCategoryList();  // 计划大类
            // 查询 供货替换组明细
            setTimeout(function(){
                _this.querySupplyRU();
            },0);            

        },
        methods:{
            handleClick(tab,event){
                var _this=this;
                if(_this.activeName=='1'){
                    _this.supplyRUForm.active="";
                    _this.supplyRUForm.code="";
                    _this.supplyRUForm.name="";
                    _this.supplyRUForm.materialCode="";
                    _this.supplyRUForm.planCategoryCode="";
                    _this.supplyRUForm.productLine="";
                    _this.legalPersonDropDownValue();  // 法人名称
                    setTimeout(function(){
                        _this.querySupplyRU(); // 查询 供货替换组明细
                    },0);
                }else{
                    _this.freeSpareForm.materialCode="";
                    _this.freeSpareForm.planCategoryCode="";
                    _this.freeSpareForm.productLine="";
                    _this.legalPersonDropDownValue();  // 法人名称
                    setTimeout(function(){
                        _this.queryFreeSpare();  // 查询  自由备件列表
                    },0);
                }                
            },
            //法人名称下拉列表值
            legalPersonDropDownValue(){  
                var _this = this;
                $.ajax({
                    type:'GET',
                    url:_this.procurement_service+"legalPerson/ofCurrentUser",
                    cache:false,
                    success:function(data){
                        if(data.success){
                            _this.legalPersonDropDown = data.data;
                            if(_this.activeName=='1'){
                                _this.supplyRUForm.legalPersonName = _this.legalPersonDropDown[0].legalPersonName;
                                _this.supplyRUForm.legalPersonId = _this.legalPersonDropDown[0].id;
                            }
                            // if(_this.activeName=='2'){
                            //     _this.freeSpareForm.legalPersonName = _this.legalPersonDropDown[0].legalPersonName;
                            //     _this.freeSpareForm.legalPersonId = _this.legalPersonDropDown[0].id;
                            // }     
                            if(_this.addVisible){
                                _this.createGReplacementForm.legalPersonName = _this.legalPersonDropDown[0].legalPersonName;
                                _this.createGReplacementForm.legalPersonId = _this.legalPersonDropDown[0].id;
                            }         
                            if(_this.updateVisible){
                                _this.updateGReplacementForm.legalPersonName = _this.legalPersonDropDown[0].legalPersonName;
                                _this.updateGReplacementForm.legalPersonId = _this.legalPersonDropDown[0].id;
                            }  
                            if(_this.seeVisible){
                                _this.seeGReplacementForm.legalPersonName = _this.legalPersonDropDown[0].legalPersonName;
                                _this.seeGReplacementForm.legalPersonId = _this.legalPersonDropDown[0].id;
                            }              
                        }else{
                            _this.common.errorTip(data.errorMessage);
                        }
                    }
                })
            },
            // 选择法人 取名称给后台
            changeLegalPerson(){
                var _this = this;
                for(var i=0;i<_this.legalPersonDropDown.length;i++){
                    if(_this.activeName=='1'){
                        if(_this.supplyRUForm.legalPersonId==_this.legalPersonDropDown[i].id){
                            _this.supplyRUForm.legalPersonName=_this.legalPersonDropDown[i].legalPersonName;
                        }
                    }
                    // if(_this.activeName=='2'){
                    //     if(_this.freeSpareForm.legalPersonId==_this.legalPersonDropDown[i].id){
                    //         _this.freeSpareForm.legalPersonName=_this.legalPersonDropDown[i].legalPersonName;
                    //     }
                    // }
                    if(_this.addVisible){
                        if(_this.createGReplacementForm.legalPersonId==_this.legalPersonDropDown[i].id){
                            _this.createGReplacementForm.legalPersonName=_this.legalPersonDropDown[i].legalPersonName;
                        }
                    }         
                    if(_this.updateVisible){
                        if(_this.updateGReplacementForm.legalPersonId==_this.legalPersonDropDown[i].id){
                            _this.updateGReplacementForm.legalPersonName=_this.legalPersonDropDown[i].legalPersonName;
                        }
                    }  
                    if(_this.seeVisible){
                        if(_this.seeGReplacementForm.legalPersonId==_this.legalPersonDropDown[i].id){
                            _this.seeGReplacementForm.legalPersonName=_this.legalPersonDropDown[i].legalPersonName;
                        }
                    } 
                }
            },
            //工程管理模块  下拉框公共接口   产品线集合 状态集合
            // getCommonList(){
            //     var _this = this;
            //     _this.productLineList=_this.common.getCommonList(["substituteForm.productLine"]);
            //     _this.statusList=_this.common.getCommonList(["supplyCluster.supplyClusterStatus"]);
            // },
            //下拉框公共接口 
            getCommonList(){
                var _this=this;
                var tmp=["substituteForm.productLine","supplyCluster.supplyClusterStatus","supplyCluster.dcinvalloprinciple","supplyCluster.clusterinvalloprinciple"];
                $.ajax({
                    type: 'POST',
                    url: _this.metadata_service+"metadata/getPullDownList",
                    cache: false,
                    data:JSON.stringify(tmp),
                    dataType:'JSON',
                    contentType: "application/json;charset=utf-8",
                    success: function (data) {
                        if (data.success) {
                            _this.productLineList=data.data['substituteForm.productLine'];//产品线集合
                            _this.statusList=data.data['supplyCluster.supplyClusterStatus'];//状态集合
                            _this.dcinvalloprincipleList=data.data['supplyCluster.dcinvalloprinciple'];// 分库库存分配原则
                            _this.clusterinvalloprincipleList=data.data['supplyCluster.clusterinvalloprinciple'];// 组内库存分配原则
                        }else{
                            _this.common.errorTip(data.errorMessage);
                        }
                    }
                })
            },
            // 计划大类
            getPlanCategoryList(){
                var _this = this;
                // _this.planCategoryList=_this.common.getPlanCategoryList();
                $.ajax({
                    type: 'GET',
                    url: _this.metadata_service+"planCategory/findPlanCategoryList",
                    cache: false,
                    success: function (data) {
                        if (data.success) {
                            _this.planCategoryList=data.data;
                        }else
                            _this.common.errorTip(data.errorMessage);
                    }
                });
            },
            // 查询 供货替换组明细
            querySupplyRU(){
                var _this=this;
                _this.loading=true;
                _this.loading2=false;
                var tmp={
                    active: _this.supplyRUForm.active,
                    code: _this.supplyRUForm.code,
                    name: _this.supplyRUForm.name,
                    legalPersonId: _this.supplyRUForm.legalPersonId,
                    materialCode: _this.supplyRUForm.materialCode,
                    planCategoryCode: _this.supplyRUForm.planCategoryCode,
                    productLine: _this.supplyRUForm.productLine,
                    pageIndex:_this.pageIndex,
                    pageSize:_this.pageSize
                };
                _this.selectDisabled=true;
                $.ajax({
                    type: 'POST',
                    url: _this.metadata_service+"supplyCluster/querySupplySubstitutionRelationship",
                    cache: false,
                    data:JSON.stringify(tmp),
                    dataType:'JSON',
                    contentType: "application/json;charset=utf-8",
                    success: function (data) {
                        if (data.success) {
                        _this.loading=false;
                        _this.isPaging=true;
                        _this.totalPage=data.data.totalPage;
                        _this.totalNumber=data.data.totalNumber;
                        _this.supplyRUData=data.data.dataList;
                        }else{
                            _this.common.errorTip(data.errorMessage)
                        }
                        _this.selectDisabled=false;
                    },
                    error:function(){
                        _this.selectDisabled=false;
                    }
                });
            },
            //分页
            handleSizeChange(val) {
                var _this=this;
                _this.pageSize=val;
                _this.querySupplyRU();
            },
            //点击页码分页查询点击事件
            handleCurrentChange(val) {
                var _this=this;
                _this.pageIndex=val;
                _this.querySupplyRU();
            },
            // 操作启用禁用
            handleStatus(index, row){
                var _this=this;
                if(row.active){
                    row.active = false;
                }else{
                    row.active = true;
                }
                var tmp={id: row.id,status: row.active};
                $.ajax({
                    type: 'POST',
                    url: _this.metadata_service+"supplyCluster/updateStatus",
                    cache: false,
                    data:JSON.stringify(tmp),
                    dataType:'JSON',
                    contentType: "application/json;charset=utf-8",
                    success: function (data) {
                    if (data.success) {
                        // 当前状态的显示
                        if(row.active){
                            row.activeName = "启用";
                            var success=_this.languageType=="zh"?'启用成功':'Enable success';
                            _this.common.successTip(success);
                        }else{
                            row.activeName = "禁用";
                            var err=_this.languageType=="zh"?'禁用成功':'Disable success';
                            _this.common.successTip(err);
                        }
                    }else
                        _this.common.errorTip(data.errorMessage);
                    }
                });
            },
            //新增供货替换组明细
            createNew(){
                var _this=this;
                //清空新增时绑定数据
                if(this.$refs['createGReplacementForm']){
                    this.$refs['createGReplacementForm'].resetFields();
                }
                _this.memberListData=[];  // 清空成员列表
                _this.addVisible=true;
            },
            // 删除 成员列表
            handleDel(index,rows){
                rows.splice(index,1);
            },
            // 下拉列表选择产品线
            selectProductline(){
                var _this=this;
                // 表格中的产品线显示汉字
                for(var i=0;i<_this.productLineList.length;i++){
                    if(_this.createGReplacementForm.productLine == _this.productLineList[i].value){
                        _this.createGReplacementForm.productLineName = _this.productLineList[i].label;
                    }
                }
                for(var i=0;i<_this.memberListData.length;i++){
                    _this.memberListData[i].productLine=_this.createGReplacementForm.productLine;
                    _this.memberListData[i].productLineName=_this.createGReplacementForm.productLineName;
                }
            },
            // 下拉列表选择计划大类
            selectPlanCategoryCode(){
                var _this=this;
                // 表格中的计划大类显示汉字
                for(var i=0;i<_this.planCategoryList.length;i++){
                    if(_this.createGReplacementForm.planCategoryCode == _this.planCategoryList[i].code){
                        _this.createGReplacementForm.planCategoryName = _this.planCategoryList[i].name;
                    }
                }
                for(var i=0;i<_this.memberListData.length;i++){
                    _this.memberListData[i].planCategoryCode=_this.createGReplacementForm.planCategoryCode;
                    _this.memberListData[i].planCategoryName=_this.createGReplacementForm.planCategoryName;
                }
            },
            // 验证  允许欠货天数 修改后采购优先级 配货优先级
            inputNumber(val){
                var _this = this;
                if(!(/^\d+$/.test(val))){
                    var err=_this.languageType=="zh"?"请输入零或者正整数！":"Please enter a zero or a positive integer!";
                    _this.common.errorTip(err);
                    return false;
                }else{
                    return true;
                }
            },
            // 新增供货替换组明细 =====》添加备件
            handleAddSpare(){
                var _this = this;
                _this.spareVisible=true;
                _this.defaultPriority="";  //Topmost 
                _this.addSpareForm.code="";  // 工程替换组编码清空
                _this.addSpareForm.materialCode="";  // 备件编码清空
                _this.spareListData=[];  //添加备件弹窗中的    按工程替换组添加查询出来的数据
                _this.spare2ListData=[];  // 添加备件弹窗中的  按备件添加查询出来的数据
                _this.selectedSpareListData=[];  //添加备件弹窗中的    按工程替换组添加操作  清空选中的备件
                _this.selectedSpare2ListData=[];   // 添加备件弹窗中的  按备件添加操作  清空选中的备件
                // _this.querySpareList();  // 默认按工程替换组添加      查询 
                if(_this.addSpareForm.radio==2){
                    _this.querySpare2List();   
                }
            },
            // 按工程替换组添加      查询
            querySpareList(){
                var _this = this;
                _this.spareListData=[];
                var tmp = {code:_this.addSpareForm.code};
                if(_this.addSpareForm.code){
                    $.ajax({
                        type: 'POST',
                        async:false,
                        url: _this.metadata_service+"substituteGroup/queryProjectsstClusterSparePart",
                        cache: false,
                        data:JSON.stringify(tmp),
                        dataType:'JSON',
                        contentType: "application/json;charset=utf-8",
                        success: function (data) {
                            if (data.success) {
                                _this.spareListData = data.data;
                            }else{
                                _this.common.errorTip(data.errorMessage);
                            }
                        }
                    });
                }else{
                    var err=_this.languageType=="zh"?"请输入工程替换组编码":"Please enter the engineering replacement group code";
                    _this.common.errorTip(err); 
                }                
            },
            // 按备件添加      查询
            querySpare2List(){
                var _this = this;
                _this.spare2ListData=[];
                var planCategoryCode,planCategoryName;
                if(_this.addVisible){
                    planCategoryCode= _this.createGReplacementForm.planCategoryCode;
                    planCategoryName= _this.createGReplacementForm.planCategoryName;
                }else if(_this.updateVisible){
                    planCategoryCode= _this.updateGReplacementForm.planCategoryCode;
                    planCategoryName= _this.updateGReplacementForm.planCategoryName;
                }
                var tmp = {planCategoryCode:planCategoryCode,materialCode:_this.addSpareForm.materialCode};
                if(planCategoryCode =="" || planCategoryCode == null){
                    var err=_this.languageType=="zh"?"请选择计划大类":"Please select a plan category";
                    _this.common.errorTip(err); 
                    return;
                }
                $.ajax({
                    type: 'POST',
                    async:false,
                    url: _this.metadata_service+"supplyCluster/queryMaterialListByCode",
                    cache: false,
                    data:JSON.stringify(tmp),
                    dataType:'JSON',
                    contentType: "application/json;charset=utf-8",
                    success: function (data) {
                        if (data.success) {
                            _this.spare2ListData = data.data;
                        }else{
                            _this.common.errorTip(data.errorMessage);
                        }
                    }
                });
            },
            
            // 添加备件弹窗中的    按工程组替换添加操作  选中的备件（同一工程替换组）
            //不属于同一个工程替换组不可选（已改需求   查出来的数据本来就属于同一个替换组，不需要加此验证）
            handleSelectedSpareList(val){
                var _this = this;
                _this.selectedSpareListData=[];
                _this.clusterCode="";
                var productLine,productLineName,planCategoryCode,planCategoryName;
                if(_this.addVisible){
                    productLine=_this.createGReplacementForm.productLine;
                    productLineName=_this.createGReplacementForm.productLineName;
                    planCategoryCode= _this.createGReplacementForm.planCategoryCode;
                    planCategoryName= _this.createGReplacementForm.planCategoryName;
                }else if(_this.updateVisible){
                    productLine=_this.updateGReplacementForm.productLine;
                    productLineName=_this.updateGReplacementForm.productLineName;
                    planCategoryCode= _this.updateGReplacementForm.planCategoryCode;
                    planCategoryName= _this.updateGReplacementForm.planCategoryName;
                }
                // if(val.length==1){
                //     _this.selectedSpareListData.push({
                //         productLine: productLine,
                //         productLineName: productLineName,
                //         planCategoryCode: planCategoryCode,
                //         planCategoryName: planCategoryName,
                //         clusterCode: val[0].code,
                //         materialCode:val[0].materialCode,
                //         materialName:val[0].materialName,
                //         borrowable: val[0].borrowable,
                //         borrowableName: val[0].borrowableName,
                //         lenovoSellable: val[0].lenovoSellable,
                //         lenovoSellableName: val[0].lenovoSellableName,
                //         serializable: val[0].serializable,
                //         serializableName: val[0].serializableName,
                //         status: val[0].status,
                //         statusName: val[0].statusName,
                //         supplierName: val[0].supplierName,
                //         topmost: false,
                //         priority: "",
                //         supplysubstituteOperationVoList: []
                //     });
                //     _this.clusterCode=val[0].code;
                // }else if(val.length > 1){
                    // for(var i=1;i<val.length;i++){
                    //     if(val[i].code != val[i-1].code){
                    //         var err=_this.languageType=="zh"?'不属于同一个工程替换组！':'Does not belong to the same engineering replacement group!';
                    //         _this.common.errorTip(err);
                    //         _this.$refs.multipleTable.toggleRowSelection(val[i]);
                    //         return;
                    //     }
                    // }
                    for(var i=0;i<val.length;i++){
                        _this.selectedSpareListData.push({
                            productLine: productLine,
                            productLineName: productLineName,
                            planCategoryCode: planCategoryCode,
                            planCategoryName: planCategoryName,
                            clusterCode: val[i].code,
                            materialCode:val[i].materialCode,
                            materialName:val[i].materialName,
                            borrowable: val[i].borrowable,
                            borrowableName: val[i].borrowableName,
                            lenovoSellable: val[i].lenovoSellable,
                            lenovoSellableName: val[i].lenovoSellableName,
                            serializable: val[i].serializable,
                            serializableName: val[i].serializableName,
                            status: val[i].status,
                            statusName: val[i].statusName,
                            supplierName: val[i].supplierName,
                            yaKuanPrice:val[i].yaKuanPrice,
                            price:val[i].price,
                            topmost: false,
                            priority: "",
                            supplysubstituteOperationVoList: []
                        });
                    }
                    // _this.clusterCode=val[0].code;
                // }
            },
            // 添加备件弹窗中的    按工程替换组添加操作
            handleSRGAdd(){
                var _this = this;
                if(_this.selectedSpareListData.length){
                    if(_this.addVisible){
                        var memberSpareCodeData=[];
                        for(var i=0;i<_this.memberListData.length;i++){
                            memberSpareCodeData.push(_this.memberListData[i].materialCode);     // 选中的备件编码的集合
                        }
                        for(var i=0;i<_this.selectedSpareListData.length;i++){
                            if(!_this.filterEleFromArr(_this.selectedSpareListData[i].materialCode,memberSpareCodeData)){
                                _this.spareVisible=false;
                                _this.memberListData.push({
                                    productLine:_this.createGReplacementForm.productLine,
                                    productLineName:_this.createGReplacementForm.productLineName,
                                    planCategoryCode: _this.createGReplacementForm.planCategoryCode,
                                    planCategoryName: _this.createGReplacementForm.planCategoryName,
                                    clusterCode: _this.selectedSpareListData[i].clusterCode,
                                    materialCode: _this.selectedSpareListData[i].materialCode,
                                    materialName: _this.selectedSpareListData[i].materialName,
                                    borrowable: _this.selectedSpareListData[i].borrowable,
                                    borrowableName: _this.selectedSpareListData[i].borrowableName,
                                    lenovoSellable: _this.selectedSpareListData[i].lenovoSellable,
                                    lenovoSellableName: _this.selectedSpareListData[i].lenovoSellableName,
                                    serializable: _this.selectedSpareListData[i].serializable,
                                    serializableName: _this.selectedSpareListData[i].serializableName,
                                    supplierName: _this.selectedSpareListData[i].supplierName,
                                    yaKuanPrice: _this.selectedSpareListData[i].yaKuanPrice,
                                    price: _this.selectedSpareListData[i].price,
                                    topmost: false,
                                    priority: "",
                                    supplysubstituteOperationVoList: []
                                });
                            }else{
                                _this.common.errorTip("备件不能重复添加");
                            }
                        }
                    }else if(_this.updateVisible){
                        var updateSpareCodeData=[];
                        for(var i=0;i<_this.updateSpareData.length;i++){
                            updateSpareCodeData.push(_this.updateSpareData[i].materialCode);
                        }
                        for(var i=0;i<_this.selectedSpareListData.length;i++){
                            if(!_this.filterEleFromArr(_this.selectedSpareListData[i].materialCode,updateSpareCodeData)){
                                _this.spareVisible=false;
                                _this.updateSpareData.push({
                                    productLine:_this.updateGReplacementForm.productLine,
                                    productLineName:_this.updateGReplacementForm.productLineName,
                                    planCategoryCode: _this.updateGReplacementForm.planCategoryCode,
                                    planCategoryName: _this.updateGReplacementForm.planCategoryName,
                                    clusterCode: _this.selectedSpareListData[i].clusterCode,
                                    materialCode: _this.selectedSpareListData[i].materialCode,
                                    materialName: _this.selectedSpareListData[i].materialName,
                                    borrowable: _this.selectedSpareListData[i].borrowable,
                                    borrowableName: _this.selectedSpareListData[i].borrowableName,
                                    lenovoSellable: _this.selectedSpareListData[i].lenovoSellable,
                                    lenovoSellableName: _this.selectedSpareListData[i].lenovoSellableName,
                                    serializable: _this.selectedSpareListData[i].serializable,
                                    serializableName: _this.selectedSpareListData[i].serializableName,
                                    supplierName: _this.selectedSpareListData[i].supplierName,
                                    yaKuanPrice: _this.selectedSpareListData[i].yaKuanPrice,
                                    price: _this.selectedSpareListData[i].price,
                                    topmost: false,
                                    priority: "",
                                    supplysubstituteOperationVoList: []
                                });
                            }else{
                                _this.common.errorTip("备件不能重复添加");
                            }
                        }
                        for(var i=0;i<_this.selectedSpareListData.length;i++){
                            
                        }
                    }
                }else{
                    var err=_this.languageType=="zh"?"请选择要添加的备件":"Please select the spare parts to add";
                    _this.common.errorTip(err);  
                }
            },
            // // 数组去重   备件不能重复添加   
            // filterArr(alreadyHaveArr,selectedArr){
            //     return selectedArr.filter(item => {return !alreadyHaveArr.includes(item)});
            // },
            // 添加备件弹窗中的    按备件添加操作  选中的备件
            selectedSpare2List(val){
                var _this = this;
                _this.selectedSpare2ListData=[];
                var productLine,productLineName,planCategoryCode,planCategoryName;
                if(_this.addVisible){
                    productLine=_this.createGReplacementForm.productLine;
                    productLineName=_this.createGReplacementForm.productLineName;
                    planCategoryCode= _this.createGReplacementForm.planCategoryCode;
                    planCategoryName= _this.createGReplacementForm.planCategoryName;
                }else if(_this.updateVisible){
                    productLine=_this.updateGReplacementForm.productLine;
                    productLineName=_this.updateGReplacementForm.productLineName;
                    planCategoryCode= _this.updateGReplacementForm.planCategoryCode;
                    planCategoryName= _this.updateGReplacementForm.planCategoryName;
                }
                for(var i=0;i<val.length;i++){
                    _this.selectedSpare2ListData.push({
                        productLine: productLine,
                        productLineName: productLineName,
                        planCategoryCode: planCategoryCode,
                        planCategoryName: planCategoryName,
                        clusterCode: val[i].code,
                        materialCode:val[i].materialCode,
                        materialName:val[i].materialName,
                        borrowable: val[i].borrowable,
                        borrowableName: val[i].borrowableName,
                        lenovoSellable: val[i].lenovoSellable,
                        lenovoSellableName: val[i].lenovoSellableName,
                        serializable: val[i].serializable,
                        serializableName: val[i].serializableName,
                        supplierName: val[i].supplierName,
                        yaKuanPrice:val[i].yaKuanPrice,
                        price:val[i].price,
                        topmost: false,
                        priority: "",
                        supplysubstituteOperationVoList: []
                    });
                }
            },
            // 添加备件弹窗中的    按备件添加操作 
            handleSpareAdd(){
                var _this = this;
                if(_this.selectedSpare2ListData.length){                    
                    if(_this.addVisible){
                        var memberSpareCodeData=[];
                        for(var i=0;i<_this.memberListData.length;i++){
                            memberSpareCodeData.push(_this.memberListData[i].materialCode);     // 选中的备件编码的集合
                        }
                        for(var i=0;i<_this.selectedSpare2ListData.length;i++){
                            if(!_this.filterEleFromArr(_this.selectedSpare2ListData[i].materialCode,memberSpareCodeData)){
                                // debugger
                                _this.spareVisible=false;
                                _this.memberListData.push({
                                    productLine:_this.createGReplacementForm.productLine,
                                    productLineName:_this.createGReplacementForm.productLineName,
                                    planCategoryCode: _this.createGReplacementForm.planCategoryCode,
                                    planCategoryName: _this.createGReplacementForm.planCategoryName,
                                    clusterCode: _this.selectedSpare2ListData[i].clusterCode,
                                    materialCode: _this.selectedSpare2ListData[i].materialCode,
                                    materialName: _this.selectedSpare2ListData[i].materialName,
                                    borrowable: _this.selectedSpare2ListData[i].borrowable,
                                    borrowableName: _this.selectedSpare2ListData[i].borrowableName,
                                    lenovoSellable: _this.selectedSpare2ListData[i].lenovoSellable,
                                    lenovoSellableName: _this.selectedSpare2ListData[i].lenovoSellableName,
                                    serializable: _this.selectedSpare2ListData[i].serializable,
                                    serializableName: _this.selectedSpare2ListData[i].serializableName,
                                    status: _this.selectedSpare2ListData[i].status,
                                    statusName: _this.selectedSpare2ListData[i].statusName,
                                    supplierName: _this.selectedSpare2ListData[i].supplierName,
                                    yaKuanPrice: _this.selectedSpare2ListData[i].yaKuanPrice,
                                    price: _this.selectedSpare2ListData[i].price,
                                    topmost: false,
                                    priority: "",
                                    supplysubstituteOperationVoList: []
                                });
                            }else{
                                _this.common.errorTip("备件不能重复添加");
                            }
                        }
                    }else if(_this.updateVisible){
                        var updateSpareCodeData=[];
                        for(var i=0;i<_this.updateSpareData.length;i++){
                            updateSpareCodeData.push(_this.updateSpareData[i].materialCode);
                        }
                        for(var i=0;i<_this.selectedSpare2ListData.length;i++){
                            if(!_this.filterEleFromArr(_this.selectedSpare2ListData[i].materialCode,updateSpareCodeData)){
                                _this.spareVisible=false;
                                _this.updateSpareData.push({
                                    productLine:_this.updateGReplacementForm.productLine,
                                    productLineName:_this.updateGReplacementForm.productLineName,
                                    planCategoryCode: _this.updateGReplacementForm.planCategoryCode,
                                    planCategoryName: _this.updateGReplacementForm.planCategoryName,
                                    clusterCode: _this.selectedSpare2ListData[i].clusterCode,
                                    materialCode: _this.selectedSpare2ListData[i].materialCode,
                                    materialName: _this.selectedSpare2ListData[i].materialName,
                                    borrowable: _this.selectedSpare2ListData[i].borrowable,
                                    borrowableName: _this.selectedSpare2ListData[i].borrowableName,
                                    lenovoSellable: _this.selectedSpare2ListData[i].lenovoSellable,
                                    lenovoSellableName: _this.selectedSpare2ListData[i].lenovoSellableName,
                                    serializable: _this.selectedSpare2ListData[i].serializable,
                                    serializableName: _this.selectedSpare2ListData[i].serializableName,
                                    status: _this.selectedSpare2ListData[i].status,
                                    statusName: _this.selectedSpare2ListData[i].statusName,
                                    supplierName: _this.selectedSpare2ListData[i].supplierName,
                                    yaKuanPrice: _this.selectedSpare2ListData[i].yaKuanPrice,
                                    price: _this.selectedSpare2ListData[i].price,
                                    topmost: false,
                                    priority: "",
                                    supplysubstituteOperationVoList: []
                                });
                            }else{
                                _this.common.errorTip("备件不能重复添加");
                            }
                        }
                    }
                }else{
                    var err=_this.languageType=="zh"?"请选择要添加的备件":"Please select the spare parts to add";
                    _this.common.errorTip(err);  
                }
            },
            // 设置采购优先级
            setPurPriority(){
                var _this = this;
                _this.purchaseData=[];   // 清空
                _this.purVisible=true;
                if(_this.addVisible){
                    for(var i=0;i<_this.memberListData.length;i++){
                        _this.purchaseData.push({
                            materialCode: _this.memberListData[i].materialCode,
                            materialName: _this.memberListData[i].materialName,
                            oldPriority: _this.memberListData[i].oldPriority,
                            priority: _this.memberListData[i].priority
                        });
                    }     
                }else if(_this.updateVisible){
                    for(var i=0;i<_this.updateSpareData.length;i++){
                        _this.purchaseData.push({
                            materialCode: _this.updateSpareData[i].materialCode,
                            materialName: _this.updateSpareData[i].materialName,
                            oldPriority: _this.updateSpareData[i].oldPriority,
                            priority: _this.updateSpareData[i].priority
                        });
                    }  
                }      
            },
            //判断采购优先级是否重复    (数组中是否存在重复元素)
            isRepeat(arr){
                var hash = {};
                for(var i=0;i<arr.length;i++) {
                    if(hash[arr[i]])
                        return true;
                        hash[arr[i]] = true;
                }
                return false;
            },
            // 设置采购优先级   确定
            handleSBGConfirm(){
                var _this = this;
                // 将输入的采购优先级 push到一个数组
                var tmpPriorityArr=[];
                for(var i=0;i<_this.purchaseData.length;i++){
                    tmpPriorityArr.push(_this.purchaseData[i].priority);
                }
                for(var i=0;i<_this.purchaseData.length;i++){
                    // 输入的采购优先级只能为0或者正整数
                    if(!_this.inputNumber(_this.purchaseData[i].priority)){
                        var err=_this.languageType=="zh"?"修改后采购优先级必须为零或者正整数！":"After modification, the purchasing priority must be zero or positive integer!";
                        _this.common.errorTip(err);
                        return;
                    }
                    // // 输入的采购优先级不能重复   （改需求：采购优先级可以重复）
                    // if(this.isRepeat(tmpPriorityArr)){
                    //     var errHad=this.languageType=="zh"?'采购优先级不能重复！':'Procurement priority cannot be repeated!';
                    //     this.common.errorTip(errHad);
                    //     return;
                    // }
                }        
                _this.purVisible=false;
                // 采购优先级对应的赋值
                if(_this.addVisible){
                    for(var i=0;i<_this.purchaseData.length;i++){
                        for(var j=0;j<_this.memberListData.length;j++){
                            if(_this.purchaseData[i].materialCode == _this.memberListData[j].materialCode){
                                _this.memberListData[j].priority = _this.purchaseData[i].priority;
                                _this.memberListData[j].oldPriority = _this.purchaseData[i].oldPriority;
                            }
                        }
                    }
                }else if(_this.updateVisible){
                    for(var i=0;i<_this.purchaseData.length;i++){
                        for(var j=0;j<_this.updateSpareData.length;j++){
                            if(_this.purchaseData[i].materialCode == _this.updateSpareData[j].materialCode){
                                _this.updateSpareData[j].priority = _this.purchaseData[i].priority;
                                _this.updateSpareData[j].oldPriority = _this.purchaseData[i].oldPriority;
                            }
                        }
                    }
                }
            },
            //设置备件替换链
            setDisPriority(index,row,parm){
                var _this=this;
                if(parm==1){
                    _this.seeFlag=true;
                }else{
                    _this.seeFlag=false;
                }
                _this.spareMSGData=[];   //清空备件信息
                _this.disVisible=true; 
                _this.spareMSGData.push(row);//备件信息
                _this.queryRSpareList(row.materialCode);  // 替换备件列表
                _this.queryCReplace(row.materialCode);  // 工程替换关系
            },
            // 设置备件替换链弹窗中  替换备件列表查询
            queryRSpareList(code){
                var _this = this;
                $.ajax({
                    type: 'GET',
                    url: _this.metadata_service + "supplyCluster/querySupplysubstituteByCode?code="+code,
                    cache: false,
                    dataType:'JSON',
                    contentType: "application/json;charset=utf-8",     //*****
                    success: function (data) {
                        if (data.success) {
                            _this.distributionData = data.data;
                        } else {
                            _this.common.errorTip(data.errorMessage);
                        }
                    }
                });  
            },
            // 设置备件替换链弹窗中   工程替换关系查询
            queryCReplace(code){
                var _this = this;
                $.ajax({
                    type: 'GET',
                    url: _this.metadata_service + "supplyCluster/queryProjectSubstituteByCode?code="+code,
                    cache: false,
                    dataType:'JSON',
                    contentType: "application/json;charset=utf-8",     //*****
                    success: function (data) {
                        if (data.success) {
                            _this.cReplaceData = data.data;
                        } else {
                            _this.common.errorTip(data.errorMessage);
                        }
                    }
                });  
            },
            // 数组是否存在某元素  (数组中是否存在某个选定的元素)
            filterEleFromArr(el,arr){
                for(var i=0;i<arr.length;i++){
                    if(arr[i] == el){
                        return true;
                    }
                }
                return false;
            },
            //设置备件替换链弹窗中     工程替换关系  添加操作
            handleAddCR(index,row){
                var _this = this;
                if(_this.distributionData.length>0){
                    var tmpCodeArr=[];
                    for(var i=0;i<_this.distributionData.length;i++){
                        tmpCodeArr.push(_this.distributionData[i].subMaterialCode);
                    }
                    if(_this.filterEleFromArr(row.subMaterialCode,tmpCodeArr)){
                        _this.common.errorTip("备件替换链不能重复！");
                    }else{
                        _this.distributionData.push({
                            subMaterialCode:row.subMaterialCode,
                            subMaterialName:row.subMaterialName,
                            yakuanPrice:row.yakuanPrice,
                            priority:""
                        });
                    }
                }else{
                    _this.distributionData.push({
                        subMaterialCode:row.subMaterialCode,
                        subMaterialName:row.subMaterialName,
                        yakuanPrice:row.yakuanPrice,
                        priority:""
                    });
                }
            },
            // 设置备件替换链  确认操作
            handleSSSConfirm(){
                var _this = this;
                // 将输入的配货优先级 push到一个数组
                var tmpDPriorityArr=[];
                for(var i=0;i<_this.distributionData.length;i++){
                    tmpDPriorityArr.push(_this.distributionData[i].priority);
                }
                for(var i=0;i<_this.distributionData.length;i++){
                    // 输入的配货优先级只能为0或者正整数
                    if(!_this.inputNumber(_this.distributionData[i].priority)){
                        var err=_this.languageType=="zh"?"配货优先级必须为零或者正整数！":"The modified distribution priority must be zero or positive integer!";
                        _this.common.errorTip(err);
                        return;
                    }
                    // 输入的配货优先级不能重复
                    if(this.isRepeat(tmpDPriorityArr)){
                        var errHad=this.languageType=="zh"?'配货优先级不能重复！':'Distribution priority can not be repeated!';
                        this.common.errorTip(errHad);
                        return;
                    }
                }  
                _this.disVisible=false;
                if(_this.addVisible){
                    for(var i=0;i<_this.memberListData.length;i++){
                        for(var j=0;j<_this.distributionData.length;j++){  
                            if(_this.memberListData[i].materialCode == _this.spareMSGData[0].materialCode){
                                _this.memberListData[i].supplysubstituteOperationVoList.push({
                                    subMaterialCode: _this.distributionData[j].subMaterialCode,
                                    subMaterialName: _this.distributionData[j].subMaterialName,
                                    yakuanPrice: _this.distributionData[j].yakuanPrice,
                                    priority: _this.distributionData[j].priority
                                });
                            }
                        }
                    }
                }else if(_this.updateVisible){
                    for(var i=0;i<_this.updateSpareData.length;i++){
                        _this.updateSpareData[i].supplysubstituteOperationVoList = [];
                        for(var j=0;j<_this.distributionData.length;j++){  
                            if(_this.updateSpareData[i].materialCode == _this.spareMSGData[0].materialCode){
                                _this.updateSpareData[i].supplysubstituteOperationVoList.push({
                                    subMaterialCode: _this.distributionData[j].subMaterialCode,
                                    subMaterialName: _this.distributionData[j].subMaterialName,
                                    yakuanPrice: _this.distributionData[j].yakuanPrice,
                                    priority: _this.distributionData[j].priority
                                });
                            }
                        }
                    }
                }
            },
            // 新增供货替换组明细====》保存
            hadleAddSave(status,active){
                var _this=this;
                _this.handleAddFunc(status,active);
            },
            // 新增供货替换组明细====》确定
            handleAddConfirm(status,active){
                var _this=this;
                _this.handleAddFunc(status,active);
            },
            handleAddFunc(status,active){
                var _this = this;
                _this.$refs["createGReplacementForm"].validate((valid) => {
                    if (valid) {
                        if(!_this.inputNumber(_this.createGReplacementForm.oweDays)){   //输入的允许欠货天数只能为正整数或者0
                             var err=_this.languageType=="zh"?"允许欠货天数必须为零或者正整数！":"The number of days allowed to owe must be zero or positive integers!";
                            _this.common.errorTip(err);
                            return;
                        }
                        if(_this.memberListData && _this.memberListData.length>0){
                            /*for(var i=0;i<_this.memberListData.length;i++){
                                if(_this.memberListData[i].supplysubstituteOperationVoList.length <= 0){
                                    _this.common.errorTip("请设置备件替换链！");
                                    return;
                                }             
                            }*/
                        }else{
                            _this.common.errorTip("成员列表不能为空！");
                            return;
                        }
                        var tmp={
                            status:status,
                            active:active,
                            legalPersonId: _this.createGReplacementForm.legalPersonId,
                            legalPersonName: _this.createGReplacementForm.legalPersonName,
                            code: _this.createGReplacementForm.code,
                            name: _this.createGReplacementForm.name,
                            productLine: _this.createGReplacementForm.productLine,
                            productLineName: _this.createGReplacementForm.productLineName,
                            planCategoryCode: _this.createGReplacementForm.planCategoryCode,
                            planCategoryName: _this.createGReplacementForm.planCategoryName,
                            dcinvalloprinciple:_this.createGReplacementForm.dcinvalloprinciple,
                            clusterinvalloprinciple:_this.createGReplacementForm.clusterinvalloprinciple,
                            oweDays: _this.createGReplacementForm.oweDays,
                            projectsstCluster:_this.createGReplacementForm.projectsstCluster,    // 工程替换组
                            supplysstclusterMaterialOperationVoList:_this.memberListData
                        };
                        _this.saveAddDisabled=true;
                        $.ajax({
                            type: 'POST',
                            url: _this.metadata_service+"supplyCluster/addSupplyCluster",
                            cache: false,
                            data:JSON.stringify(tmp),
                            dataType:'JSON',
                            contentType: "application/json;charset=utf-8",
                            success: function (data) {
                                if (data.success) {
                                    _this.addVisible=false;
                                    var success=_this.languageType=="zh"?'操作成功':'Successful operation';
                                    _this.common.successTip(success);
                                    _this.querySupplyRU();  // 查询 供货替换组明细
                                }else{
                                    _this.common.errorTip(data.errorMessage)
                                }
                                _this.saveAddDisabled=false;
                            },
                            error:function(){
                                _this.saveAddDisabled=false;
                            }
                        });
                    } else {
                        var err=_this.languageType=="zh"?'存在未填写的必填项！':'Have Empty';
                        _this.common.errorTip(err);
                        return false;
                    }
                });
            },
            // 修改供货替换组明细
            handleUpdate(index,row){
                var _this = this;
                //清空绑定数据
                if(this.$refs['updateGReplacementForm']){
                    this.$refs['updateGReplacementForm'].resetFields();
                }
                _this.updateVisible=true;
                _this.handleFuncSee(index,row);
            },
            // 修改供货替换组明细 ====》添加备件
            handleUpdateAddSpare(){
                var _this=this;
                _this.spareVisible=true;
                _this.selectedSpareListData=[];  //添加备件弹窗中的    按工程替换组添加操作  清空选中的备件
                _this.selectedSpare2ListData=[];   // 添加备件弹窗中的  按备件添加操作  清空选中的备件
                // _this.querySpareList();  // 默认按工程替换组添加      查询 
            },
            // 修改供货替换组明细=====》保存
            handleUpdateSave(status,active){
                var _this=this;
                _this.handleUpdateFunc(status,active);
            },
            // 修改供货替换组明细====》确定
            handleUpdateConfirm(status,active){
                var _this=this;
                _this.handleUpdateFunc(status,active);
            },
            handleUpdateFunc(status,active){
                var _this = this;
                _this.$refs["updateGReplacementForm"].validate((valid) => {
                    if (valid) {
                        // 输入的允许欠货天数只能为0或者正整数
                        if(!_this.inputNumber(_this.updateGReplacementForm.oweDays)){
                            var err=_this.languageType=="zh"?"允许欠货天数必须为零或者正整数！":"The number of days allowed to owe must be zero or positive integers!";
                            _this.common.errorTip(err);
                            return;
                        }
                        if(_this.updateSpareData && _this.updateSpareData.length>0){
                            /*for(var i=0;i<_this.updateSpareData.length;i++){
                                // if(_this.updateSpareData[i].priority == "" || _this.updateSpareData[i].priority == null){
                                //     _this.common.errorTip("采购优先级不能为空！");
                                //     return;
                                // }
                                if(_this.updateSpareData[i].supplysubstituteOperationVoList.length <= 0){
                                    _this.common.errorTip("请设置备件替换链！");
                                    return;
                                }      
                                // //topmost
                                // if(_this.defaultPriority == _this.updateSpareData[j].materialCode){
                                //     _this.updateSpareData[j].topmost=true;
                                // }                 
                            }*/
                        }else{
                            _this.common.errorTip("成员列表不能为空！");
                            return;
                        }
                        var tmp={
                            id:_this.updateId,
                            status:status,
                            active:active,
                            legalPersonId: _this.updateGReplacementForm.legalPersonId,
                            legalPersonName: _this.updateGReplacementForm.legalPersonName,
                            code: _this.updateGReplacementForm.code,
                            name: _this.updateGReplacementForm.name,
                            productLine: _this.updateGReplacementForm.productLine,
                            productLineName: _this.updateGReplacementForm.productLineName,
                            planCategoryCode: _this.updateGReplacementForm.planCategoryCode,
                            planCategoryName: _this.updateGReplacementForm.planCategoryName,
                            dcinvalloprinciple:_this.updateGReplacementForm.dcinvalloprinciple,
                            clusterinvalloprinciple:_this.updateGReplacementForm.clusterinvalloprinciple,
                            oweDays: _this.updateGReplacementForm.oweDays,
                            projectsstCluster:_this.updateGReplacementForm.projectsstCluster,    // 工程替换组
                            supplysstclusterMaterialOperationVoList:_this.updateSpareData
                        };
                        _this.updateAddDisabled=true;
                        $.ajax({
                            type: 'POST',
                            url: _this.metadata_service+"supplyCluster/updateSupplyCluster",
                            cache: false,
                            data:JSON.stringify(tmp),
                            dataType:'JSON',
                            contentType: "application/json;charset=utf-8",
                            success: function (data) {
                                if (data.success) {
                                    _this.updateVisible=false;
                                    var success=_this.languageType=="zh"?'操作成功':'Successful operation';
                                    _this.common.successTip(success);
                                    _this.querySupplyRU();  // 查询 供货替换组明细
                                }else{
                                    _this.common.errorTip(data.errorMessage)
                                }
                                _this.updateAddDisabled=false;
                            },
                            error:function(){
                                _this.updateAddDisabled=false;
                            }
                        });
                    } else {
                        var err=_this.languageType=="zh"?'存在未填写的必填项！':'Have Empty';
                        _this.common.errorTip(err);
                        return false;
                    }
                });
            },
            // 查看供货替换组明细
            handleSee(index,row){
                var _this = this;
                _this.seeVisible=true;
                _this.handleFuncSee(index,row);
            },
            handleFuncSee(index,row){
                var _this = this;
                _this.updateId=row.id;
                _this.defaultPriority="";
                $.ajax({
                    type: 'GET',
                    url: _this.metadata_service+"supplyCluster/see?id="+_this.updateId,
                    cache: false,
                    // data:JSON.stringify(tmp),
                    dataType:'JSON',
                    contentType: "application/json;charset=utf-8",
                    success: function (data) {
                        if (data.success) {
                            if(_this.updateVisible){
                                _this.updateGReplacementForm=data.data;
                                _this.updateSpareData=data.data.supplysstclusterMaterialOperationVoList;
                                for(var i=0;i<_this.updateSpareData.length;i++){
                                    if(_this.updateSpareData[i].topmost){
                                        _this.defaultPriority = _this.updateSpareData[i].materialCode;
                                    }
                                }
                            }
                            if(_this.seeVisible){
                                _this.seeGReplacementForm=data.data;
                                _this.seeSpareData=data.data.supplysstclusterMaterialOperationVoList;
                                for(var i=0;i<_this.seeSpareData.length;i++){
                                    if(_this.seeSpareData[i].topmost){
                                        _this.defaultPriority = _this.seeSpareData[i].materialCode;
                                    }
                                }
                            }
                        }else{
                            _this.common.errorTip(data.errorMessage)
                        }
                    }
                });
            },
            // 查询  自由备件列表
            queryFreeSpare(){
                var _this=this;
                _this.loading2=true;
                _this.loading=false;
                var tmp={
                    // legalPersonId: _this.freeSpareForm.legalPersonId,
                    materialCode: _this.freeSpareForm.materialCode,
                    planCategoryCode: _this.freeSpareForm.planCategoryCode,
                    productLine: _this.freeSpareForm.productLine,
                    pageIndex:_this.pageIndex2,
                    pageSize:_this.pageSize2
                };
                _this.select2Disabled=true;
                $.ajax({
                    type: 'POST',
                    url: _this.metadata_service+"supplyCluster/queryFreeSpares",
                    cache: false,
                    data:JSON.stringify(tmp),
                    dataType:'JSON',
                    contentType: "application/json;charset=utf-8",
                    success: function (data) {
                        if (data.success) {
                            _this.loading2=false;
                            _this.isPaging2=true;
                            _this.totalPage2=data.data.totalPage;
                            _this.totalNumber2=data.data.totalNumber;
                            _this.freeSpareData=data.data.dataList;
                        }else{
                            _this.common.errorTip(data.errorMessage)
                        }
                        _this.select2Disabled=false;
                    },
                    error:function(){
                        _this.select2Disabled=true;
                    }
                });
            },
            //分页
            handleSizeChange2(val) {
                this.pageSize2=val;
                this.queryFreeSpare();
            },
            //点击页码分页查询点击事件
            handleCurrentChange2(val) {
                this.pageIndex2=val;
                this.queryFreeSpare();

            }
        }
    }
</script>



